<?php
require 'dbconnect.inc.php';
$a=$_SESSION['annot'];
$b=$_SESSION['id'];
$user='pakshal';
$id=$b[0];

$px25='25px';
$px20='20px';

$reslt=mysqli_query($link,"select text from content where id='$id'");
$txt=mysqli_fetch_array($reslt);
echo '<div id="right_panel_text">';
if(mysqli_num_rows($reslt)!=0) { echo '"'.$txt['text'].'"'; }
elseif(mysqli_num_rows($reslt)==0) {echo 'Click on a highlighted text portion to view its annotations!<br><br><br><br>';}
echo '</div>';

for($j=0;$j<count($a);$j++)
{
	  echo '<h3 class="text_line"></h3><hr style="border" color="black"></h3>
      		<div id="annotationpanel" >';
      echo $a[$j];
      echo '</div>';
      echo '<div id="votepanel">'; 
      echo '<form action="incrmvote.php" method="POST">';
      $id=$b[$j];
      $voteresult=mysqli_query($link,"select * from votes where id='$id' and user='$user'");
      $votenumrows=mysqli_num_rows($voteresult);
      $voterow=mysqli_fetch_array($voteresult);
      
        if($voterow['votetype']==1 && $votenumrows>0)
      echo '<input type="image" name="submit" value="up" src="static/up.jpg" height="25px" width="25px" style="vertical-align:middle;"><br>';
        else
      echo '<input type="image" name="submit" value="up" src="static/up.jpg" height="20px" width="20px" style="vertical-align:middle;"><br>';

          $reslt=mysqli_query($link,"select * from content where id='$id'");
          $row=mysqli_fetch_array($reslt);
      echo '<div id="current_vote">&nbsp;'.$row['votes'].'</div>';
        if($voterow['votetype']==0 && $votenumrows>0)
      echo '<input type="image" name="submit" value="down" src="static/down.jpg" height="25px" width="25px" style="vertical-align:middle;">';
  		else
  	  echo '<input type="image" name="submit" value="down" src="static/down.jpg" height="20px" width="20px style="vertical-align:middle;">';
      echo	'<input  type="hidden" name="hide" value="'.$b[$j].'"> 
      		</form>
      		</div>
            <div id="annotation_property"> Created by '.$row['user'].' on '.$row['date'].'</div>';

}
echo '<h3 class="text_line"></h3><hr style="border" color="black"></h3>';

?>
